package com.example.demo.service.impl;

import com.example.demo.service.AnalysisService;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;

public abstract class AbstractAnalysisService implements AnalysisService {


    private static final Map<String,AnalysisService> map = new HashMap<>();

    public static final String HUAWEI_NAME = "hw";
    public static final String YITU_NAME = "yt";

    @PostConstruct
    public void init(){
        map.put(getAnalysisCompany(),this);
    }

    public static AnalysisService getService(String company){
        AnalysisService service = map.get(company);
        if(service == null){
            service = map.get(HUAWEI_NAME);
        }
        return service;
    }

}
